package com.example.administrator.baikangxing.holder;

import android.view.View;
import android.widget.TextView;

import com.example.administrator.baikangxing.MyApplication;
import com.example.administrator.baikangxing.R;
import com.example.administrator.baikangxing.bean.BloodPressureBean;
import com.example.administrator.baikangxing.utils.Utils;

/**
 * Created by Sushil_Shen on 2017/5/19/0019.
 * Contact: Sushil_shen@163.com
 */

public class BloodPressureHolder extends BaseHolder<BloodPressureBean> {

    private TextView bloodpressure_item_tv_time;
    private TextView bloodpressure_item_tv_num;

    @Override
    protected View getHolderView() {
        View view = View.inflate(MyApplication.context, R.layout.bloodpressure_list_item, null);
        bloodpressure_item_tv_time = (TextView) view.findViewById(R.id.bloodpressure_item_tv_time);
        bloodpressure_item_tv_num = (TextView) view.findViewById(R.id.bloodpressure_item_tv_num);
        return view;
    }

    @Override
    public void bindData(BloodPressureBean bloodPressureBean) {
        String avghighpressure = bloodPressureBean.getAvghighpressure().trim();
        String avglowpressure = bloodPressureBean.getAvglowpressure().trim();
        bloodpressure_item_tv_num.setText(Utils.stringToInt(avghighpressure)+"/"+Utils.stringToInt(avglowpressure));
        bloodpressure_item_tv_time.setText(bloodPressureBean.getTime()+":00");
    }
}
